import request from "../utils"

export let add_cart = (userid: any, proid: any, num: number) => {
    return request({
        url: "/api/cart/add",
        method: "POST",
        data: {
            userid, proid, num
        }
    })
}

export let cart_list = (userid: any) => {
    return request({
        url: "/api/cart/list",
        method: "POST",
        data: {
            userid
        }
    })
}

export let selectone = (cartid: any,flag:boolean) => {
    return request({
        url: "/api/cart/selectone",
        method: "POST",
        data: {
            cartid,flag
        }
    })
}

export let selectall = (userid: any,type:boolean) => {
    return request({
        url: "/api/cart/selectall",
        method: "POST",
        data: {
            userid,type
        }
    })
}

export let updatenum = (cartid: any,num:number) => {
    return request({
        url: "/api/cart/updatenum",
        method: "POST",
        data: {
            cartid,num
        }
    })
}

export let remove = (cartid: any) => {
    return request({
        url: "/api/cart/remove",
        method: "POST",
        data: {
            cartid
        }
    })
}

export let removeall = (userid: any) => {
    return request({
        url: "/api/cart/removeall",
        method: "POST",
        data: {
            userid
        }
    })
}